* Apply to:  sfmay_2018_voters.dta
* Description:  Table A4

clear


import excel "...\2204 JEPS\sfmay_2018.xls", sheet("Sheet1") firstrow


* Demographic Predictors

gen interest_hi = 0
replace interest_hi = 1 if interest==1
replace interest_hi = . if interest==.

gen college = 0
replace college = 1 if education==5
replace college = . if education==.

gen minority = 0
replace minority = 1 if race!=1
replace minority = . if race==.

gen female = 0
replace female = 1 if gender==2
replace female = . if gender==.

gen indoth = 0
replace indoth = 1 if party==4
replace indoth = 1 if party==8
replace indoth = . if party==.

gen republican = 0
replace republican = 1 if party>=1 & party<=3
replace republican = . if party==.


* Choose to Receive Information

gen info_choice = 0
replace info_choice = 1 if treatment2==7 | treatment2==8
replace info_choice = . if treatment2 < 6


* Table A4.  Determinants of Choosing to Receive Information
* Six head-to-head matchups pooled

version 13.1

set seed X075bcd151f123bb5159a55e50022865700043e55

estsimp logit info_choice interest_hi college ideology ///
     minority female indoth republican
	 
setx median
simqi, prval(1) listx

simqi, fd(prval(1) genpr(fd_interest_hi)) changex(interest_hi 0 1)
simqi, fd(prval(1) genpr(fd_college)) changex(college 0 1)
simqi, fd(prval(1) genpr(fd_ideology)) changex(ideology 1 7)
simqi, fd(prval(1) genpr(fd_minority)) changex(minority 0 1)
simqi, fd(prval(1) genpr(fd_female)) changex(female 0 1)
simqi, fd(prval(1) genpr(fd_indoth)) changex(indoth 0 1)
simqi, fd(prval(1) genpr(fd_republican)) changex(republican 0 1)

tabstat fd_interest_hi, s(min p5 p25 p50 p75 p95 max)
tabstat fd_college, s(min p5 p25 p50 p75 p95 max)
tabstat fd_ideology, s(min p5 p25 p50 p75 p95 max)
tabstat fd_minority, s(min p5 p25 p50 p75 p95 max)
tabstat fd_female, s(min p5 p25 p50 p75 p95 max)
tabstat fd_indoth, s(min p5 p25 p50 p75 p95 max)
tabstat fd_republican, s(min p5 p25 p50 p75 p95 max)


clear


* First differences in probability choose information

set obs 7

gen covariate = [_n]


gen point_est = -0.184
replace point_est = .104 if covariate==6
replace point_est = -.258 if covariate==5
replace point_est = .257 if covariate==4
replace point_est = .018 if covariate==3
replace point_est = .036 if covariate==2
replace point_est = .036 if covariate==1


gen bound_lo = -.320
replace bound_lo = -.024 if covariate==6
replace bound_lo = -.450 if covariate==5
replace bound_lo = .137 if covariate==4
replace bound_lo = -.121 if covariate==3
replace bound_lo = -.131 if covariate==2
replace bound_lo = -.160 if covariate==1


gen bound_hi = -.016
replace bound_hi = .225 if covariate==6
replace bound_hi = -.055 if covariate==5
replace bound_hi = .374 if covariate==4
replace bound_hi = .157 if covariate==3
replace bound_hi = .210 if covariate==2
replace bound_hi = .245 if covariate==1


* Figure A2.  Determinants of Choosing to Receive Information

graph twoway line covariate bound_lo, ///
     clcolor(black) clwidth(thick) clpattern(blank) || ///
     (scatter covariate point_est, mcolor(black) msize(large)) || ///
	 rcap bound_lo bound_hi covariate, horizontal lcolor(black) lpattern(solid) ///
	 title(" ") xlabel(-.80(.20).45, notick nolabel) xtick(-.40(.10).40) xtitle(" " " " "{bf: }" ) ///
	 ylabel(0(1)7, notick nolabel) ytitle("{bf: }") ///
     xline(0, lpattern(dash) lcolor(black)) ///
	 text(1 -.78 "{bf:Republican}", color(black) placement(east) just(left)) ///
	 text(2 -.78 "{bf:Independent/Other}", color(black) placement(east) just(left)) ///
	 text(3 -.78 "{bf:Female}", color(black) placement(east) just(left)) ///
	 text(4 -.78 "{bf:Minority}", color(black) placement(east) just(left)) ///
	 text(5 -.78 "{bf:Ideology}", color(black) placement(east) just(left)) ///
	 text(6 -.78 "{bf:College Degree}", color(black) placement(east) just(left)) ///
	 text(7 -.78 "{bf:High Interest}", color(black) placement(east) just(left)) ///
	 text(-.65 -.40 "-.40", color(black)) ///
	 text(-.65 -.30 "-.30", color(black)) ///
	 text(-.65 -.20 "-.20", color(black)) ///
	 text(-.65 -.10 "-.10", color(black)) ///
	 text(-.65 0 "0", color(black)) ///
	 text(-.65 .10 ".10", color(black)) ///
	 text(-.65 .20 ".20", color(black)) ///
	 text(-.65 .30 ".30", color(black)) ///
	 text(-.65 .40 ".40", color(black)) ///
	 text(-1.25 0 "{bf:Effect on Probability Choose Information}", color(black)) ///
	 legend(off) plotregion(color(white)) graphregion(color(white))

* End



